package work20241226;

/**
 * @author zdl
 * @date 2024/12/26
 */
public class Demo2 {
    public static void main(String[] args) {
        //2. 实现Runnable接口，创建两个线程，分别输出奇数和偶数。
        new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 100; i++) {
                    if (i % 2 != 0) {
                        System.out.println(i + "\t");

                    }
                }

            }
        }).start();
        new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 100; i++) {
                    if (i % 2 == 0) {
                        System.out.println(i + "\t");

                    }
                }
            }
        }).start();
    }
}
